package chapter02

/**
 * @program lu-scala01
 * @description: 函数懒加载
 * @author: zhanglu
 * @create: 2022-03-08 10:34:00
 */
object C11_FuncLazy {

  def main(args: Array[String]): Unit = {
    test01
  }

  def test01 {
    lazy val res = sum(13, 17)
    println("1. 函数调用")
    println("2. res = " + res)
    println("3. res = " + res)

    def sum(a: Int, b: Int): Int = {
      println("3. sum调用")
      a + b
    }

  }

}
